<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="AgendaCreateDlg" widgetVar="AgendaCreateDialog" modal="true" resizable="false" appendTo="@(body)" header="#{bundle.CreateAgendaTitle}">
            <h:form id="AgendaCreateForm">
                <h:panelGroup id="display">
                    <p:panelGrid columns="2" rendered="#{agendaController.selected != null}">
                        <p:outputLabel value="#{bundle.CreateAgendaLabel_telefonocasa}" for="telefonocasa" />
                        <p:inputMask id="telefonocasa" value="#{agendaController.selected.telefonocasa}" 
                                     title="#{bundle.CreateAgendaTitle_telefonocasa}" required="true" 
                                     requiredMessage="#{bundle.CreateAgendaRequiredMessage_telefonocasa}"
                                     mask="099999999"/>
                        
                        <p:outputLabel value="#{bundle.CreateAgendaLabel_telefonotrabajo}" for="telefonotrabajo" />
                        <p:inputMask id="telefonotrabajo" value="#{agendaController.selected.telefonotrabajo}" 
                                     title="#{bundle.CreateAgendaTitle_telefonotrabajo}" required="true" 
                                     requiredMessage="#{bundle.CreateAgendaRequiredMessage_telefonotrabajo}"
                                     mask="0999999999"/>
                        
                        <p:outputLabel value="#{bundle.CreateAgendaLabel_direccion}" for="direccion" />
                        <p:inputTextarea id="direccion" value="#{agendaController.selected.direccion}" 
                                     title="#{bundle.CreateAgendaTitle_direccion}" required="true" 
                                     requiredMessage="#{bundle.CreateAgendaRequiredMessage_direccion}"
                                     rows="2" cols="22" autoResize="false" />
                        
                        <p:outputLabel value="#{bundle.CreateAgendaLabel_mail}" for="mail" />
                        <p:inputText id="mail" value="#{agendaController.selected.mail}" 
                                     title="#{bundle.CreateAgendaTitle_mail}" required="true"
                                     requiredMessage="#{bundle.CreateAgendaRequiredMessage_mail}"/>
                        
                        <p:outputLabel value="#{bundle.CreatePacientesLabel_cedula}" for="idpaciente" />
                        <p:selectOneMenu id="idpaciente" value="#{agendaController.selected.idpaciente}" 
                                         required="true" requiredMessage="#{bundle.EditAgendaRequiredMessage_idpaciente}">
                            <f:selectItems value="#{pacientesController.itemsAvailableSelectOne}"
                                           var="idpacienteItem"
                                           itemValue="#{idpacienteItem}"/>
                        </p:selectOneMenu>
                    </p:panelGrid>
                    <p:commandButton actionListener="#{agendaController.create}" value="#{bundle.Save}" update="display,:AgendaListForm:datalist,:growl" oncomplete="handleSubmit(args,'AgendaCreateDialog');"/>
                    <p:commandButton value="#{bundle.Cancel}" onclick="AgendaCreateDialog.hide()"/>
                </h:panelGroup>
            </h:form>
        </p:dialog>

    </ui:composition>
</html>
